function object(o) {
    function F() {}
    F.prototype = o
    return new F()
}
/**
 * prototype.__proto__ = F.prototype = SuperType.prototype
 * 所以
 * prototype.constructor是SuperType
 * 因此下面中需要再指定prototype的contructor
 */
function inheritPrototype(SubType, SuperType) {
    let prototype = object(SuperType.prototype)
    // 防止重写原型导致constructor丢失
    prototype.constructor = SubType
    SubType.prototype = prototype
}
function SuperType(name) {
    this.name = name
    this.nums = [1, 2, 3]
}
SuperType.prototype.say = function() {
    console.log('我是' + this.name);
}
function SubType(name, age) {
    SuperType.call(this, name)
    this.age = age
}
inheritPrototype(SubType, SuperType)
SubType.prototype.sayAge = function() {
    console.log('我' + this.age + '岁啦');
}
let p1 = new SubType('zzy', 100)
p1.say()
p1.sayAge()
// 与组合式的区别就是只调用了一次父类的构造函数